//: gui/SubmitSwingProgram.java
package no22.gui;

import javax.swing.*;
import java.util.concurrent.*;

/**
 * 此时SubmitSwingProgram自身就是 一个构件,通过SwingUtilities启动
 * 
 * @author gao
 * 
 */
public class SubmitSwingProgram extends JFrame {
	JLabel label;

	public SubmitSwingProgram() {
		super("Hello Swing");
		label = new JLabel("A Label");
		add(label);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(300, 100);
		setVisible(true);
	}

	static SubmitSwingProgram ssp;

	public static void main(String[] args) throws Exception {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				ssp = new SubmitSwingProgram();
			}
		});
		TimeUnit.SECONDS.sleep(1);
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				ssp.label.setText("Hey! This is Different!");
			}
		});
	}
} // /:~
